/* 主体布局 */
.content-area {
    padding: 16px;
    background: #f6f9fc;
    min-height: calc(100vh - 60px);
}

/* 商品管理区域 */
.product-section {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* 头部区域 */
.product-header {
    padding: 12px 16px;
    border-bottom: 1px solid #eef0f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-right {
    display: flex;
    align-items: center;
}

.search-form {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-form .form-control {
    height: 34px;
    font-size: 13px;
}

.search-form .btn {
    height: 34px;
    padding: 0 16px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.search-form .btn i {
    font-size: 12px;
}

.search-form .btn-primary {
    background-color: #4096ff;
    border-color: #4096ff;
    min-width: 80px;
}

.search-form .btn-primary:hover {
    background-color: #1677ff;
    border-color: #1677ff;
}

.search-form .btn-success {
    background-color: #52c41a;
    border-color: #52c41a;
    min-width: 100px;
}

.search-form .btn-success:hover {
    background-color: #73d13d;
    border-color: #73d13d;
}

/* 分类选择下拉框 */
.category-select {
    min-width: 120px;
    max-width: 200px;
}

/* 搜索输入框 */
#searchName {
    min-width: 200px;
    max-width: 300px;
}

/* 商品列表 */
.product-list {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    background: #f9f9f9;
    min-height: calc(100vh - 200px);
}

.product-item {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    border-bottom: 1px solid #eef0f5;
    transition: all 0.2s;
}

.product-item-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.product-image {
    width: 80px;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f8fafc;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.product-info {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 24px;
    margin-left: 24px;
}

.product-info h4 {
    margin: 0;
    font-size: 12px;
    color: #1e293b;
    font-weight: 500;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-price {
    font-size: 13px;
    color: #ef4444;
    font-weight: 600;
}

.product-stock {
    font-size: 11px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 3px;
}

.product-stock i {
    font-size: 11px;
    color: #94a3b8;
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    display: inline-block;
    min-width: 64px;
    text-align: center;
    margin-right: 16px;
}

.badge-success {
    background: #f6ffed;
    color: #52c41a;
    border: 1px solid #b7eb8f;
}

.badge-warning {
    background: #fff7e6;
    color: #fa8c16;
    border: 1px solid #ffd591;
}

.product-actions {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    opacity: 0;
    transition: all 0.2s;
    padding: 12px;
}

.product-item:hover .product-actions {
    opacity: 1;
}

.product-actions .btn {
    width: 100%;
    padding: 5px 14px;
    font-size: 13px;
    border-radius: 3px;
    background: transparent;
    border: 1px solid #e2e8f0;
    color: #475569;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.product-actions .btn:hover {
    transform: translateY(-1px);
}

.product-actions .btn-primary {
    border-color: #3b82f6;
    color: #3b82f6;
}

.product-actions .btn-primary:hover {
    background: #3b82f6;
    color: #fff;
}

.product-actions .btn-warning {
    border-color: #f59e0b;
    color: #f59e0b;
}

.product-actions .btn-warning:hover {
    background: #f59e0b;
    color: #fff;
}

.product-actions .btn-danger {
    border-color: #ef4444;
    color: #ef4444;
}

.product-actions .btn-danger:hover {
    background: #ef4444;
    color: #fff;
}

.product-actions .btn i {
    font-size: 13px;
}

/* 加载和空数据状态 */
.loading, .no-data {
    grid-column: 1 / -1;
    text-align: center;
    padding: 24px;
    color: #86909c;
    font-size: 13px;
    background: #f7f8fa;
    border-radius: 4px;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.loading:before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #e0e3e9;
    border-top-color: #4096ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 表模态框 */
.modal-dialog {
    max-width: 400px;
    margin: 1.75rem auto;
}

.modal-content {
    border: none;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.modal-header {
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #eef0f5;
}

.modal-title {
    font-size: 15px;
    font-weight: normal;
    color: #1f2329;
}

.modal-body {
    padding: 16px;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    color: #4e5969;
    font-size: 13px;
    font-weight: normal;
}

.form-control {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #e0e3e9;
    border-radius: 4px;
    font-size: 13px;
    transition: all 0.2s;
}

.form-control:focus {
    border-color: #4096ff;
    box-shadow: 0 0 0 2px rgba(64,150,255,.1);
}

/* 图片上传区域 */
.upload-area {
    border: 1px dashed #e0e3e9;
    border-radius: 4px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
}

.upload-area:hover {
    border-color: #4096ff;
    background: #f0f7ff;
}

.upload-area.dragover {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

.upload-icon {
    font-size: 24px;
    color: #86909c;
    margin-bottom: 8px;
}

.upload-text {
    font-size: 13px;
    color: #4e5969;
    margin-bottom: 4px;
}

.upload-tip {
    font-size: 11px;
    color: #86909c;
}

.file-input {
    display: none;
}

.preview-container {
    margin-top: 8px;
    position: relative;
    display: inline-block;
}

#imagePreview {
    max-width: 100%;
    max-height: 150px;
    border-radius: 4px;
}

.btn-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s;
}

.btn-remove:hover {
    background: rgba(0,0,0,0.7);
    transform: scale(1.1);
}

.upload-progress {
    margin-top: 15px;
}

.progress-bar {
    height: 4px;
    background: #4CAF50;
    border-radius: 2px;
    transition: width 0.3s;
}

.progress-text {
    text-align: center;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

/* 响应式布局 */
@media (max-width: 768px) {
    .product-header {
        flex-direction: column;
        gap: 15px;
    }

    .header-left, .header-right {
        width: 100%;
    }

    .search-form {
        width: 100%;
    }

    #searchName {
        width: 100%;
    }

    .category-select {
        width: 100%;
    }

    .product-list {
        grid-template-columns: 1fr;
    }

    .product-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* 分类列表 */
.category-list {
    padding: 8px 16px;
}

.category-item {
    margin-bottom: 2px;
    transition: all 0.2s;
}

.category-header {
    padding: 0 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 40px;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 6px;
}

.category-header:hover {
    background: #f0f7ff;
}

.category-name {
    font-size: 13px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-name i {
    font-size: 12px;
    color: #94a3b8;
    transition: transform 0.2s;
}

.category-name.expanded i {
    transform: rotate(90deg);
    color: #3b82f6;
}

.category-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.category-item:hover .category-actions {
    opacity: 1;
}

.category-actions .btn {
    padding: 4px 12px;
    font-size: 12px;
    border-radius: 4px;
    background: #fff;
    color: #3b82f6;
    border: 1px solid #3b82f6;
    transition: all 0.2s;
}

.category-actions .btn:hover {
    background: #3b82f6;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.category-actions .btn i {
    font-size: 11px;
}

.category-container {
    display: none;
    padding: 16px 12px;
    background: #fff;
    margin: 4px 0;
    border-radius: 8px;
}

.category-container.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 商品列表样式 */
.product-grid {
    display: flex;
    flex-direction: column;
}

.product-item {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    border-bottom: 1px solid #eef0f5;
    transition: all 0.2s;
}

.product-item:hover {
    background: #f8fafc;
}

.product-image {
    width: 80px;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-info {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 24px;
    margin-left: 24px;
}

.product-name {
    width: 220px;
    font-size: 15px;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-price {
    width: 100px;
    font-size: 15px;
    color: #ef4444;
}

.product-stock {
    width: 100px;
    font-size: 15px;
    color: #64748b;
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    display: inline-block;
    min-width: 64px;
    text-align: center;
    margin-right: 16px;
}

.badge-success {
    background: #f6ffed;
    color: #52c41a;
    border: 1px solid #b7eb8f;
}

.badge-warning {
    background: #fff7e6;
    color: #fa8c16;
    border: 1px solid #ffd591;
}

.product-actions {
    display: flex;
    gap: 12px;
    margin-left: auto;
    position: static;
    opacity: 1;
    background: none;
    padding: 0;
    flex-direction: row;
    width: auto;
    height: auto;
}

.product-actions .btn {
    padding: 6px 16px;
    font-size: 14px;
    border-radius: 4px;
    background: transparent;
    border: 1px solid #e2e8f0;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 85px;
    justify-content: center;
}

.product-actions .btn:hover {
    transform: translateY(-1px);
}

.product-actions .btn-primary {
    border-color: #4096ff;
    color: #4096ff;
}

.product-actions .btn-primary:hover {
    background: #4096ff;
    color: #fff;
}

.product-actions .btn-warning {
    border-color: #fa8c16;
    color: #fa8c16;
}

.product-actions .btn-warning:hover {
    background: #fa8c16;
    color: #fff;
}

.product-actions .btn-danger {
    border-color: #ff4d4f;
    color: #ff4d4f;
}

.product-actions .btn-danger:hover {
    background: #ff4d4f;
    color: #fff;
}

.product-actions .btn i {
    font-size: 14px;
}

/* 搜索区域样式 */
.search-form {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-form .btn {
    padding: 8px 16px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-form .btn-success {
    background-color: #52c41a;
    border-color: #52c41a;
}

.search-form .btn-success:hover {
    background-color: #73d13d;
    border-color: #73d13d;
}

/* 加载和空数据状态 */
.no-data {
    padding: 16px;
    text-align: center;
    color: #8c8c8c;
    font-size: 13px;
    background: #fafafa;
    border-radius: 4px;
    margin: 8px;
} 